<?php
/**
 * Created by PhpStorm.
 * User: gengxin
 * Date: 2016/2/29
 * Time: 9:58
 */

namespace Admin\Controller;

/**
 * 定时任务
 *
 * Class CrontabController
 *
 * @package Admin\Controller
 */
class OrderController extends AdminCommonController
{
    /**
     * 订单列表
     */
    public function index()
    {
        $model = M('order');
        $list = $model->order('create_time desc')->select();
        if ($list) {
            // 加入时间处理
            foreach ($list as $k => $v) {
                $list[$k]['create_time'] = timeToDate($v['create_time']);
                $list[$k]['status_show'] = C('ddz_order')[$v['status']];
            }
            $this->assign('order_info' ,$list);
        }
        $this->display();
    }

    /**
     * 订单详情
     */
    public function detail()
    {
        $id = I('id');
        $model = M('order');
        $list = $model->getById($id);
        if ($list) {

            $list['status'] = C('ddz_order')[$list['status']];

            $this->assign('vo' ,$list);


            $this->display();
        }else{
            $this->redirect('/Public/error-500');
        }

    }

}